from urllib import request as ur
import urllib.parse
import gzip

url = 'http://www.xbiquge.la/xiaoshuodaquan/'

headers = {
    'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.120 Safari/537.36',

}

req = ur.Request(url=url,headers=headers)
print(req)
res = ur.urlopen(req)
s = res.read()
# gzip在python中可以处理压缩流数据，gzip中的decompress可以进行解压缩，compress可以进行压缩
print(gzip.decompress(s).decode())